package com.xh.shuati.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.xh.shuati.model.dto.questionBankQuestion.QuestionBankQuestionBatchAddRequest;
import com.xh.shuati.model.dto.questionBankQuestion.QuestionBankQuestionQueryRequest;
import com.xh.shuati.model.entity.QuestionBankQuestion;
import com.xh.shuati.model.entity.User;
import com.xh.shuati.model.vo.QuestionBankQuestionVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 题目题库关联服务
 *
 * @author <a href="https://github.com/canon0521">xh</a>
 */
public interface QuestionBankQuestionService extends IService<QuestionBankQuestion> {

    /**
     * 校验数据
     *
     * @param questionBankQuestion
     * @param add                  对创建的数据进行校验
     */
    void validQuestionBankQuestion(QuestionBankQuestion questionBankQuestion, boolean add);

    /**
     * 获取查询条件
     *
     * @param questionBankQuestionQueryRequest
     * @return
     */
    QueryWrapper<QuestionBankQuestion> getQueryWrapper(QuestionBankQuestionQueryRequest questionBankQuestionQueryRequest);

    /**
     * 获取题目题库关联封装
     *
     * @param questionBankQuestion
     * @param request
     * @return
     */
    QuestionBankQuestionVO getQuestionBankQuestionVO(QuestionBankQuestion questionBankQuestion, HttpServletRequest request);

    /**
     * 分页获取题目题库关联封装
     *
     * @param questionBankQuestionPage
     * @param request
     * @return
     */
    Page<QuestionBankQuestionVO> getQuestionBankQuestionVOPage(Page<QuestionBankQuestion> questionBankQuestionPage, HttpServletRequest request);


    /**
     * 批量添加题目到题库
     *
     * @param questionIds
     * @param bankId
     * @param loginUser
     */
    void batchAddQuestionsToBank(List<Long> questionIds, Long bankId, User loginUser);

    /**
     * 批量删除题目到题库
     *
     * @param questionIds
     * @param bankId
     */
    void batchRemoveQuestionsToBank(List<Long> questionIds, Long bankId);

    void batchAddQuestionsToBankInner(List<QuestionBankQuestion> collect);
}
